const arr = ['a', 'a', 'a', 'b', 'b', 'c', 'c', 'c', 'c', 'd', 'd', 'd', 'd'];
const result = arr.reduce((pre, cur) => {
  if (!pre[cur]) {
    pre[cur] = 1;
  } else {
    pre[cur]++;
  }
  return pre;
}, {});

console.log(result);
